﻿<Window x:Class="CPPEI.Coolzon.UI.DataPartLib.XProperty.Editors.GridColumnConditionImageDetail"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.UI.DataPartLib.XProperty.Editors"
        xmlns:datapartlib="clr-namespace:CPPEI.Coolzon.UI.DataPartLib"
        xmlns:runtime="clr-namespace:CPPEI.Coolzon.Designtime;assembly=CPPEI.Coolzon.UI"
        mc:Ignorable="d"
        Title="条件图片" Height="500" Width="500" Topmost="True" ShowInTaskbar="False" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen"
        Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <ObjectDataProvider x:Key="picData" MethodName="GetImageList" ObjectType="{x:Type local:GridColumnConditionImageDetail}">

        </ObjectDataProvider>
        <ObjectDataProvider x:Key="temData" MethodName="GetTemList" ObjectType="{x:Type local:GridColumnConditionImageDetail}">

        </ObjectDataProvider>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}" Grid.Row="0" Orientation="Horizontal">
            <Button Name="_ctlAdd" Style="{DynamicResource AddButtonStyle}" FontSize="15" VerticalContentAlignment="Center" Width="36" Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
            <Button Name="_ctlRemove" Style="{DynamicResource RemoveButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
        </StackPanel>
        <TextBox Grid.Row="1" Text="条件示例:dataSeries.getItem('bjd').value.replace('%','') > 100&#13;parseFloat(data.value.replace('%','')) >= 100"  IsReadOnly="True" FontSize="16"/>
        <ListView Grid.Row="2" x:Name="_ctlImageDetailView" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
            <ListView.ItemTemplate>
                <DataTemplate DataType="datapartlib:GridColumnConditionImage" >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="*" SharedSizeGroup="Col2"/>
                        </Grid.ColumnDefinitions>

                        <Image Margin="5"  Width="100" MaxHeight="100" Source="{Binding Path=ImageSource, Mode=TwoWay}" GotFocus="Element_GotFocus" ></Image>
                        <Grid Grid.Column="1" GotFocus="Element_GotFocus" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Row="0" Grid.Column="0" Text="图片"  Margin="5" HorizontalAlignment="Right"/>
                            <ComboBox  Grid.Row="0" Grid.Column="1" MinWidth="105" Margin="3"  ItemsSource="{Binding Source={StaticResource ResourceKey=picData}}" Tag="{Binding BindsDirectlyToSource=True}"  SelectionChanged="cbPicName_SelectionChanged"  Loaded="ComboBox_Loaded"  >
                                <ComboBox.ItemTemplate>
                                    <HierarchicalDataTemplate DataType="{x:Type runtime:ImageRes}" >
                                        <TextBlock Text="{Binding Name}"/>
                                    </HierarchicalDataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>

                            <TextBlock  Grid.Row="1"  Grid.Column="0" Text="条件"  Margin="5" HorizontalAlignment="Right" />
                            <TextBox Grid.Row="1"   Grid.Column="1" Text="{Binding Path=Condition, Mode=TwoWay}" Margin="3"/>
                            <TextBlock Grid.Row="2" Grid.Column="0" Text="模板名称"  Margin="5" HorizontalAlignment="Right"/>
                            <ComboBox Grid.Row="2" Grid.Column="1"  SelectedItem="{Binding Path=TemplateName, Mode=TwoWay}" ItemsSource="{Binding Source={StaticResource ResourceKey=temData}}" Margin="3"/>
                        </Grid>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <Grid Grid.Row="3" Grid.ColumnSpan="2">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" Width="75" />
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click" Width="75"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
